#@adminLayout()

#define content()
#if(notice)
<script>
  alert("#(notice)");
</script>
#end
<div class="am-cf am-padding am-padding-bottom-0">
  <div class="am-fl am-cf">
    <strong class="am-text-primary am-text-lg">[业务统计]</strong>
  </div>
</div>
<hr>
<div class="am-g">
  <div class="am-u-md-6">
    <form id="queryForm" class="am-form am-form-inline" action="/admin/operation/count" method="post">
    <!--
    <div class="am-form-group">
      <select name="year" data-am-selected="{btnWidth:'150'}">
        #for(i = 2018; i <= 2025; i++)
          #if(i == year)
            <option value="#(i)">#(i) 年</option>
          #else
            <option value="#(i)">#(i) 年</option>
          #end
        #end
      </select>
    </div>
    -->
    <div class="am-form-group">
      <input type="text" id="date" name="date" class="am-form-field" placeholder="选择查询日期" data-am-datepicker readonly required />
    </div>
    <div class="am-form-group">
      <button class="am-btn am-btn-success" type="button" onclick="submitForm();">查询</button>
    </div>
    </form>
  </div>
</div>
<div class="am-g">
  <div class="am-u-sm-12">
    <table class="am-table am-table-striped am-table-hover table-main">
      <thead>
      <tr>
        <th class="table-id">ID</th>
        <th>操作员名称</th>
        <th>操作数量</th>
        <th>操作</th>
      </tr>
      </thead>
      <tbody>
      #set(total = 0)
      #for(record : recordList)
      <tr>
        <td>#(for.count)</td>
        <td>#(record.getStr("operator"))</td>
        <td>#(record.getInt("ct"))</td>
        <td><a href="/admin/operation/view?date=#(date)&operator=#(record.getStr('operator'))">查看详细</a></td>
        #set(total = total + record.getInt("ct"))
        #if(for.last)
        <tr>
          <td colspan="2" style="text-align: right">合计</td>
          <td>#(total)</td>
          <td></td>
        </tr>
        #end
      </tr>
      #else
      <tr>
        <td colspan="5" style="text-align: center">暂无记录</td>
      </tr>
      #end
      </tbody>
    </table>
  </div>
</div>
#end

<script language="javascript">
  function submitForm() {
    var dateStr = $("#date").val();
    if(dateStr == "") {
      alert("请选择查询时间");
      return;
    } else {
      $("#queryForm").submit();
    }
  }
</script>